package com.example.springboot3005web.controller;


import com.example.springboot3005web.vo.User;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.io.IOException;


@Controller
public class JSONController {

    @RequestMapping("/exam/json")
    public void responseJson(HttpServletResponse response) throws IOException {
        String data="{\"name\":\"lisi\",\"age\":20}";
        response.getWriter().println(data);
    }

//    @RequestMapping("/exam/json2")
//    @GetMapping("/exam/json2")
//    @ResponseBody
//    public User user() {
//        return new User("zhangsan",12);
//    }

}
